package com.cjm.one.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.SecurityConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.coupon.client.CouponInfoClient;
import com.cjm.one.model.coupon.dto.OrderCalculateDTO;
import com.cjm.one.model.coupon.vo.CouponInfoVo;
import com.cjm.one.model.coupon.vo.GoodsDiscountVO;
import com.cjm.one.service.CouponInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CouponInfoServiceImpl implements CouponInfoService {
    @Resource
    private CouponInfoClient couponInfoClient;
    @Override
    public Result<Page<CouponInfoVo>> getList(Long current, Long size, Integer rangeType) {

        return couponInfoClient.getList(current, size, rangeType);
    }

    @Override
    public Result<List<GoodsDiscountVO>> calculateBestDiscount(OrderCalculateDTO calculateDTO) {
        return couponInfoClient.calculateBestDiscount(calculateDTO, SecurityConstants.INNER);
    }
}
